<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">

</head>
<body>
		<div class="topjui-fluid">
			<fieldset>
				<legend>部门信息</legend>
			</fieldset>
			<div class="topjui-row">
				<div class="topjui-col-sm6">
					<label class="topjui-form-label">部门编号</label>
					<div class="topjui-input-block">
					<input id="posnum" type="text" name="depnum"
                            style="" class="textbox-f" data-toggle="topjui-textbox"
                            data-options="required:true,prompt:'必填',validType:'maxLength[20]'"  />
					</div>
				</div>
				<div class="topjui-col-sm6">
					<label class="topjui-form-label">部门名称</label>
					<div class="topjui-input-block">
						<input type="text" data-toggle="topjui-textbox"
							data-options="required:true,prompt:'必填',validType:'maxLength[30]'" name="depname" id="depname"
							class="textbox-f"  style="display: none;">
					</div>
				</div>
			</div>
			<div class="topjui-row">
				<div class="topjui-col-sm6">
					<label class="topjui-form-label">上级部门</label>
					<div class="topjui-input-block">
                    <input type="hidden" name="pname" id="pname">
                    <input type="text" name="pid"
                           data-toggle="topjui-combotree"
                           data-options="required:true,
	                       prompt:'必填',
	                       textField:'text',
	                       valueField:'id',
	                       onSelect:function(node){
	                       	$('#pname').val(node.text)
	                       },
	                       method:'get',
	                       url:'/dep/queryDepartmentList'">
                	</div>
				</div>
		</div>
		</div>
		<div class="topjui-fluid">
			<fieldset>
				<legend>关联职位</legend>
			</fieldset>
			<div class="topjui-row">
				<div class="topjui-col-sm10">
					<label class="topjui-form-label">职位</label>
					<div class="topjui-input-block">
					<input id="depozw" type="text" name="depozw"
                            style="" class="textbox-f" data-toggle="topjui-combotree"
                            data-options="required:true,prompt:'必填',
                            method:'get',
                            textField:'text',
                            valueField:'posid',
                            multiple:true,
	                        panelHeight:200,
                            onLoadSuccess:function(node,data){
                            	var _this = this;
                            	$.get('/dep/queryDepAndPosition?id='+ID,function(result){
                            		var jsondata = JSON.parse(result);
							        if(jsondata.data){
							        
							        	console.log($('#depozw').combotree('tree'));
							        	$(jsondata.data).each(function(i, obj){
			                                var n = $(_this).tree('find',obj.posid);
			                                if(n){
			                                    $(_this).tree('check',n.target);
			                                }
                            			});
							        }
  								});
	                      	},
                            checkbox:true,
                            valueField:'id',
	                       	url:'/position/queryAllPostion'"  />
					</div>
				</div>
			</div>
		</div>
	
</body>
</html>